package com.cw.demo.adapter;

import lombok.extern.slf4j.Slf4j;

/**
 * 声音播放器
 *
 * @author chenw
 * @date 2021/1/10
 */
@Slf4j
public class AudioPlayer implements MediaPlayer{
    private MediaAdapter mediaAdapter;
    @Override
    public void play(String audioType, String fileName) {
        if(audioType.equals("mp3")){
            log.info("播放mp3：{}",fileName);
        }else if(audioType.equals("vlc") || audioType.equals("mp4")){
            mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType,fileName);
        }else{
            log.info("不支持的音频格式");
        }
    }
}
